<template>
    <div class="all">
        <div class="img">
            <van-icon
                :name="require('@/assets/icon_60_success@2x.png')"
                size="60" />
        </div>
        <div class="result">{{typeText}}</div>
        <div class="result-no">{{ $t('wp-dan-hao') }}:{{maintainworkorderid}}</div>
        <div class="button-group">
            <van-button
                class="confirm"
                round
                type="primary"
                @click="goto('maitenancecheckorderdetail', { maintainworkorderid: maintainworkorderid})">{{ $t('wp-wei-jian-xiang-qing') }}</van-button>
            <van-button
                class="confirm"
                round
                @click="goto('maintenancelist')">{{ $t('wp-fan-hui-wei-jian-gong-dan-lie-biao') }}</van-button>
        </div>
    </div>
</template>
<script>
import { selfI18n } from '@/i18n';
import { useRouter, useRoute } from 'vue-router';
import { computed, onMounted } from 'vue';

export default {
    setup (props, ctx) {
        const router = useRouter();
        const route = useRoute();

        const maintainworkorderid = computed(() => {
            return route.query.maintainworkorderid;
        });

        const typeText = computed(() => {
            const typeObj = {
                check: selfI18n('wp-nin-yi-yan-shou'),
                finish: selfI18n('wp-nin-yi-cheng-gong-jie-dan')
            };
            return typeObj[route.query.type];
        });

        const goto = (page, params) => {
            router.push({
                replace: true,
                name: page,
                params: {
                    ...params,
                    type: 'maintaincecheckorder'
                }
            });
        };

        onMounted(() => {
            const titleObj = {
                check: selfI18n('wp-yi-yan-shou'),
                finish: selfI18n('wp-yi-jie-dan')
            };
            document.title = titleObj[route.query.type];
        });

        return {
            goto,
            maintainworkorderid,
            typeText
        };
    }
};
</script>
<style lang="scss" scoped>
.all {
    height: 100vh;
    background-color: #fff;
    padding-top: 45px;
    box-sizing: border-box;
    .img{
        margin: 0 auto 15px auto;
        width: 60px;
        height: 60px;
        border-radius: 30px;
    }
    .result {
        font-size: 15px;
        margin-bottom: 10px;
        text-align: center;
    }
    .result-no {
        font-size: 13px;
        color: rgba(0,0,0,0.60);
        text-align: center;
    }
    .button-group{
        text-align: center;
        margin-top: 60px;
    }
    .confirm{
        width: 180px;
        height: 35px;
        margin: 0 auto 15px auto;
        display: block;
        font-size: 17px;
    }
}
</style>
